#include <iostream>
#include <Console.h>

ostream cout;

ostream &ostream::operator<<(const char *str) {
	while (*str) {
		Console::PutChar(*str);
		str++;
	}
	
	return *this;
}

ostream &ostream::operator<<(char c) {
	Console::PutChar(c);

	return *this;
}

ostream &ostream::operator<<(unsigned int n) {
	char buf[11];
	int count = 0;

	if (n == 0) {
		*this << '0';
		return *this;
	}
	
	while (n) {
		buf[count] = n % 10;
		n /= 10;
		count++;
	}

	while (count--) {
		Console::PutChar(buf[count] + 0x30);
	}
	
	return *this;
}

ostream &ostream::operator<<(int n) {
	if (n < 0) {
		*this << '-';
		n = -n;
	}
	
	*this << (unsigned) n;
	
	return *this;
}
